package com.epro.dx.task;

import java.util.ArrayList;

import com.epro.dx.listenner.MyAsyncTaskListenner;
import com.epro.dx.util.ActivityUtil;
import com.weipu.common.facade.exception.DxException;
import com.weipu.common.facade.factory.ProviderFactory;
import com.weipu.common.facade.model.ActiveModel;

import android.content.Context;
import android.os.AsyncTask;

/************************
 * @author Tony
 * @Date:2016-6-2下午1:49:12
 * @描述:获取活动状态详情
 ************************/
public class GetActiveInfoAsyncTask extends AsyncTask<Void, Void, String> {

	private MyAsyncTaskListenner myAsyncTaskListenner;
	private int getType;
	private String dataID;
	private ActiveModel activeModel;
	public GetActiveInfoAsyncTask(int getType,String dataID,MyAsyncTaskListenner myAsyncTaskListenner){
		this.getType = getType;
		this.dataID = dataID;
		this.myAsyncTaskListenner = myAsyncTaskListenner;
		
	}
	@Override
	protected void onPreExecute() {
		if(null!=myAsyncTaskListenner){
			myAsyncTaskListenner.onPreTask();
		}
		super.onPreExecute();
	}
	@Override
	protected String doInBackground(Void... params) {
		try {
			activeModel = ProviderFactory.createAdPromotionServiceProvider().GetActiveInfor(getType, dataID);
		} catch (DxException e) {
			return e.getErrCode();
		}
		return "0";
	}
	@Override
	protected void onPostExecute(String result) {
		super.onPostExecute(result);
		if(null!=myAsyncTaskListenner){
			myAsyncTaskListenner.onPostTask(result, activeModel);
		}
	}

}
